package com.lee.dao;

import com.lee.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentDao {

    // sql 学的不过关啊  id,你要插入id 那么就需要你写的 你缺少个字段 如果你不想设置id 可以把id搞成数据库自增的
    @Insert("insert into student(id,name,age,sex,major) values (#{id},#{name},#{age},#{sex},#{major})")
    void insert(Student student);

    @Update("update student set name = #{name}, age = #{age},sex = #{sex},major = #{major} where id = #{id}")
    void update(Student student);

    @Delete("delete from student where id= #{id}")
    void delete(Integer id);

    @Select("select * from student where id = #{id} ")
    Student getStudentById(int id);

    @Select("select * from  student")
    List<Student> selectAll();

}
